package com.example.sjly.ui.scheduling;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.sjly.R;
import com.example.sjly.db.LoginUser;
import com.example.sjly.sqliteroom.AppRoomDatabase;
import com.example.sjly.ui.scheduling.room.TOrderIn;
import com.example.sjly.ui.scheduling.room.TOrderRoomDatabase;


import java.util.List;

public class Schedulingmessgathnext  extends AppCompatActivity {

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_scheduling_messagegather_smallnext);
        final EditText teachername=(EditText) findViewById(R.id.smallnexteditTextName);
        final EditText teacherphone=(EditText) findViewById(R.id.smallnexteditTextphoto);
        final EditText teacheremali=(EditText) findViewById(R.id.smallnexteditTextemail);
        final EditText teachertpa=(EditText) findViewById(R.id.smallnexteditTextaddress);//拍摄地址


        findViewById(R.id.smallnextbutton).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                String name=teachername.getText().toString();
                String phone=teacherphone.getText().toString();
                String email=teacheremali.getText().toString();
                String address=teachertpa.getText().toString();

                LoginUser loginUser=LoginUser.getInstance();
                String username=loginUser.getUsername();
                TOrderRoomDatabase TIn=TOrderRoomDatabase.getInstance(getApplicationContext());
                TOrderIn tin=new TOrderIn(username,name,phone,email,address);;
                TIn.torderinDAO().insert(tin);

                Toast.makeText(Schedulingmessgathnext.this,"保存成功",Toast.LENGTH_SHORT).show();

                finish();
            }
        });
    }


}
